<template>
  <van-popup v-model="showPicker" :close-on-click-overlay="false" round position="bottom">
    <van-picker
      :title="title"
      show-toolbar
      :columns="columns"
      @confirm="$event => onConfirm($event, 'country')"
      @cancel="onCancel"
    />
  </van-popup>
</template>

<script>
// 不支持 import
module.exports = {
  data: function () {
    return {
      showPicker: false,
      title: '',
      columns: [],
      param: '',
    };
  },
  components: {},
  methods:{
    open({ title, columns, param }) {
      this.title = title;
      this.columns = columns;
      this.param = param;
      this.showPicker = true;
    },
    onConfirm(e) {
      this.$emit('change', {
        param: this.param,
        value: e,
      });
      this.showPicker = false;
    },
    onCancel() {
      this.showPicker = false;
    }
  }
};
</script>

<style>

</style>